{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>记录ID</th>\n",
       "      <th>销售日期</th>\n",
       "      <th>省份</th>\n",
       "      <th>城市</th>\n",
       "      <th>商品ID</th>\n",
       "      <th>计数</th>\n",
       "      <th>总价格</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>5349043</td>\n",
       "      <td>2015-05-22 06:16:00</td>\n",
       "      <td>河北省</td>\n",
       "      <td>丰宁满族自治县</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "      <td>125</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>5339074</td>\n",
       "      <td>2015-05-11 02:42:00</td>\n",
       "      <td>山东省</td>\n",
       "      <td>沂源县</td>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>5339150</td>\n",
       "      <td>2015-05-13 01:23:00</td>\n",
       "      <td>广东省</td>\n",
       "      <td>罗定市</td>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>5339162</td>\n",
       "      <td>2015-05-01 12:10:00</td>\n",
       "      <td>山东省</td>\n",
       "      <td>滕州市</td>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5339197</td>\n",
       "      <td>2015-05-12 19:56:00</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>5339203</td>\n",
       "      <td>2015-05-17 11:16:00</td>\n",
       "      <td>福建省</td>\n",
       "      <td>长汀县</td>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>5339205</td>\n",
       "      <td>2015-05-29 20:20:00</td>\n",
       "      <td>山东省</td>\n",
       "      <td>招远市</td>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>5339051</td>\n",
       "      <td>2015-05-25 05:15:00</td>\n",
       "      <td>西藏</td>\n",
       "      <td>工布江达县</td>\n",
       "      <td>9</td>\n",
       "      <td>3</td>\n",
       "      <td>435</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>5339052</td>\n",
       "      <td>2015-05-24 12:35:00</td>\n",
       "      <td>内蒙古</td>\n",
       "      <td>卓资县</td>\n",
       "      <td>9</td>\n",
       "      <td>3</td>\n",
       "      <td>435</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>5339234</td>\n",
       "      <td>2015-05-30 09:21:00</td>\n",
       "      <td>江苏省</td>\n",
       "      <td>淮阴市</td>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>5339337</td>\n",
       "      <td>2015-05-19 09:56:00</td>\n",
       "      <td>广东省</td>\n",
       "      <td>开平市</td>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>5339352</td>\n",
       "      <td>2015-05-21 20:30:00</td>\n",
       "      <td>云南省</td>\n",
       "      <td>大姚县</td>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>5339395</td>\n",
       "      <td>2015-05-11 17:03:00</td>\n",
       "      <td>甘肃省</td>\n",
       "      <td>秦安县</td>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>5339057</td>\n",
       "      <td>2015-05-07 21:01:00</td>\n",
       "      <td>江苏省</td>\n",
       "      <td>南京市</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "      <td>121</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>5339058</td>\n",
       "      <td>2015-05-14 13:35:00</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>杭州市</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>178</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>5339397</td>\n",
       "      <td>2015-05-03 00:52:00</td>\n",
       "      <td>上海市</td>\n",
       "      <td>闸北区</td>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>5339467</td>\n",
       "      <td>2015-05-14 08:51:00</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>龙游县</td>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>5339572</td>\n",
       "      <td>2015-05-27 16:19:00</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>永嘉县</td>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>5339062</td>\n",
       "      <td>2015-05-16 20:35:00</td>\n",
       "      <td>陕西省</td>\n",
       "      <td>西安市</td>\n",
       "      <td>7</td>\n",
       "      <td>2</td>\n",
       "      <td>242</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>5339577</td>\n",
       "      <td>2015-05-07 08:03:00</td>\n",
       "      <td>山东省</td>\n",
       "      <td>嘉祥县</td>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>5339584</td>\n",
       "      <td>2015-05-23 02:54:00</td>\n",
       "      <td>山东省</td>\n",
       "      <td>海阳县</td>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>5339065</td>\n",
       "      <td>2015-05-07 10:32:00</td>\n",
       "      <td>上海市</td>\n",
       "      <td>嘉定区</td>\n",
       "      <td>9</td>\n",
       "      <td>3</td>\n",
       "      <td>435</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>5339639</td>\n",
       "      <td>2015-05-02 21:07:00</td>\n",
       "      <td>上海市</td>\n",
       "      <td>奉贤县</td>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>5339675</td>\n",
       "      <td>2015-05-12 23:13:00</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>苍南县</td>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>5339681</td>\n",
       "      <td>2015-05-06 15:51:00</td>\n",
       "      <td>江苏省</td>\n",
       "      <td>江阴市</td>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>5339069</td>\n",
       "      <td>2015-05-05 21:14:00</td>\n",
       "      <td>山东省</td>\n",
       "      <td>枣庄市</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>198</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>5339070</td>\n",
       "      <td>2015-05-27 23:23:00</td>\n",
       "      <td>广东省</td>\n",
       "      <td>深圳市</td>\n",
       "      <td>9</td>\n",
       "      <td>1</td>\n",
       "      <td>145</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>5339071</td>\n",
       "      <td>2015-05-17 17:52:00</td>\n",
       "      <td>四川省</td>\n",
       "      <td>巫溪县</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>297</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>5339072</td>\n",
       "      <td>2015-05-16 12:29:00</td>\n",
       "      <td>江苏省</td>\n",
       "      <td>常州市</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>5339073</td>\n",
       "      <td>2015-05-04 13:49:00</td>\n",
       "      <td>河北省</td>\n",
       "      <td>景县</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>198</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9970</th>\n",
       "      <td>5348653</td>\n",
       "      <td>2015-05-12 11:46:00</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>舟山市</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9971</th>\n",
       "      <td>5349015</td>\n",
       "      <td>2015-05-05 17:01:00</td>\n",
       "      <td>江苏省</td>\n",
       "      <td>沛县</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>297</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9972</th>\n",
       "      <td>5348669</td>\n",
       "      <td>2015-05-14 06:38:00</td>\n",
       "      <td>广西</td>\n",
       "      <td>蒙山县</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9973</th>\n",
       "      <td>5349017</td>\n",
       "      <td>2015-05-03 06:33:00</td>\n",
       "      <td>广东省</td>\n",
       "      <td>潮阳市</td>\n",
       "      <td>7</td>\n",
       "      <td>3</td>\n",
       "      <td>363</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9974</th>\n",
       "      <td>5348771</td>\n",
       "      <td>2015-05-29 11:17:00</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>文成县</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9975</th>\n",
       "      <td>5349019</td>\n",
       "      <td>2015-05-04 04:54:00</td>\n",
       "      <td>湖南省</td>\n",
       "      <td>新邵县</td>\n",
       "      <td>1</td>\n",
       "      <td>4</td>\n",
       "      <td>396</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9976</th>\n",
       "      <td>5349020</td>\n",
       "      <td>2015-05-26 13:51:00</td>\n",
       "      <td>广东省</td>\n",
       "      <td>珠海市</td>\n",
       "      <td>5</td>\n",
       "      <td>1</td>\n",
       "      <td>100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9977</th>\n",
       "      <td>5349021</td>\n",
       "      <td>2015-05-28 01:32:00</td>\n",
       "      <td>江苏省</td>\n",
       "      <td>徐州市</td>\n",
       "      <td>7</td>\n",
       "      <td>2</td>\n",
       "      <td>242</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9978</th>\n",
       "      <td>5348781</td>\n",
       "      <td>2015-05-16 09:21:00</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>宁波市</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9979</th>\n",
       "      <td>5348801</td>\n",
       "      <td>2015-05-05 08:48:00</td>\n",
       "      <td>山东省</td>\n",
       "      <td>嘉祥县</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9980</th>\n",
       "      <td>5348816</td>\n",
       "      <td>2015-05-18 13:27:00</td>\n",
       "      <td>海南省</td>\n",
       "      <td>屯昌县</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9981</th>\n",
       "      <td>5349025</td>\n",
       "      <td>2015-05-03 20:15:00</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>龙游县</td>\n",
       "      <td>9</td>\n",
       "      <td>1</td>\n",
       "      <td>145</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9982</th>\n",
       "      <td>5348827</td>\n",
       "      <td>2015-05-14 14:51:00</td>\n",
       "      <td>广东省</td>\n",
       "      <td>河源市</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9983</th>\n",
       "      <td>5349027</td>\n",
       "      <td>2015-06-01 04:04:00</td>\n",
       "      <td>山东省</td>\n",
       "      <td>齐河县</td>\n",
       "      <td>7</td>\n",
       "      <td>3</td>\n",
       "      <td>363</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9984</th>\n",
       "      <td>5349028</td>\n",
       "      <td>2015-05-08 01:44:00</td>\n",
       "      <td>广东省</td>\n",
       "      <td>惠东县</td>\n",
       "      <td>7</td>\n",
       "      <td>2</td>\n",
       "      <td>242</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9985</th>\n",
       "      <td>5349029</td>\n",
       "      <td>2015-05-15 10:05:00</td>\n",
       "      <td>四川省</td>\n",
       "      <td>成都市</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>267</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9986</th>\n",
       "      <td>5348863</td>\n",
       "      <td>2015-05-09 18:12:00</td>\n",
       "      <td>江苏省</td>\n",
       "      <td>溧阳市</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9987</th>\n",
       "      <td>5349031</td>\n",
       "      <td>2015-05-05 18:49:00</td>\n",
       "      <td>江苏省</td>\n",
       "      <td>南京市</td>\n",
       "      <td>9</td>\n",
       "      <td>2</td>\n",
       "      <td>290</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9988</th>\n",
       "      <td>5349032</td>\n",
       "      <td>2015-05-23 07:20:00</td>\n",
       "      <td>上海市</td>\n",
       "      <td>普陀区</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>178</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9989</th>\n",
       "      <td>5348866</td>\n",
       "      <td>2015-05-03 19:07:00</td>\n",
       "      <td>上海市</td>\n",
       "      <td>虹口区</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9990</th>\n",
       "      <td>5349034</td>\n",
       "      <td>2015-05-18 09:03:00</td>\n",
       "      <td>黑龙江</td>\n",
       "      <td>桦川县</td>\n",
       "      <td>7</td>\n",
       "      <td>2</td>\n",
       "      <td>242</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9991</th>\n",
       "      <td>5348888</td>\n",
       "      <td>2015-05-23 10:02:00</td>\n",
       "      <td>上海市</td>\n",
       "      <td>松江县</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9992</th>\n",
       "      <td>5348910</td>\n",
       "      <td>2015-05-27 21:54:00</td>\n",
       "      <td>江苏省</td>\n",
       "      <td>泰州市</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9993</th>\n",
       "      <td>5348914</td>\n",
       "      <td>2015-05-25 18:16:00</td>\n",
       "      <td>山西省</td>\n",
       "      <td>宁武县</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9994</th>\n",
       "      <td>5348924</td>\n",
       "      <td>2015-05-01 10:10:00</td>\n",
       "      <td>广东省</td>\n",
       "      <td>新会市</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9995</th>\n",
       "      <td>5348938</td>\n",
       "      <td>2015-05-14 13:48:00</td>\n",
       "      <td>山西省</td>\n",
       "      <td>闻喜县</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9996</th>\n",
       "      <td>5348996</td>\n",
       "      <td>2015-05-06 17:34:00</td>\n",
       "      <td>上海市</td>\n",
       "      <td>徐汇区</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9997</th>\n",
       "      <td>5349003</td>\n",
       "      <td>2015-05-03 14:04:00</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>苍南县</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9998</th>\n",
       "      <td>5349042</td>\n",
       "      <td>2015-05-03 09:54:00</td>\n",
       "      <td>云南省</td>\n",
       "      <td>凤庆县</td>\n",
       "      <td>-1</td>\n",
       "      <td>3</td>\n",
       "      <td>297</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9999</th>\n",
       "      <td>5349004</td>\n",
       "      <td>2015-05-26 14:04:00</td>\n",
       "      <td>山东省</td>\n",
       "      <td>日照市</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>10000 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         记录ID                销售日期   省份       城市  商品ID  计数  总价格\n",
       "0     5349043 2015-05-22 06:16:00  河北省  丰宁满族自治县     7   1  125\n",
       "1     5339074 2015-05-11 02:42:00  山东省      沂源县    10   1    5\n",
       "2     5339150 2015-05-13 01:23:00  广东省      罗定市    10   1    5\n",
       "3     5339162 2015-05-01 12:10:00  山东省      滕州市    10   1    5\n",
       "4     5339197 2015-05-12 19:56:00  广东省      广州市    10   1    5\n",
       "5     5339203 2015-05-17 11:16:00  福建省      长汀县    10   1    5\n",
       "6     5339205 2015-05-29 20:20:00  山东省      招远市    10   1    5\n",
       "7     5339051 2015-05-25 05:15:00   西藏    工布江达县     9   3  435\n",
       "8     5339052 2015-05-24 12:35:00  内蒙古      卓资县     9   3  435\n",
       "9     5339234 2015-05-30 09:21:00  江苏省      淮阴市    10   1    5\n",
       "10    5339337 2015-05-19 09:56:00  广东省      开平市    10   1    5\n",
       "11    5339352 2015-05-21 20:30:00  云南省      大姚县    10   1    5\n",
       "12    5339395 2015-05-11 17:03:00  甘肃省      秦安县    10   1    5\n",
       "13    5339057 2015-05-07 21:01:00  江苏省      南京市     7   1  121\n",
       "14    5339058 2015-05-14 13:35:00  浙江省      杭州市     3   2  178\n",
       "15    5339397 2015-05-03 00:52:00  上海市      闸北区    10   1    5\n",
       "16    5339467 2015-05-14 08:51:00  浙江省      龙游县    10   1    5\n",
       "17    5339572 2015-05-27 16:19:00  浙江省      永嘉县    10   1    5\n",
       "18    5339062 2015-05-16 20:35:00  陕西省      西安市     7   2  242\n",
       "19    5339577 2015-05-07 08:03:00  山东省      嘉祥县    10   1    5\n",
       "20    5339584 2015-05-23 02:54:00  山东省      海阳县    10   1    5\n",
       "21    5339065 2015-05-07 10:32:00  上海市      嘉定区     9   3  435\n",
       "22    5339639 2015-05-02 21:07:00  上海市      奉贤县    10   1    5\n",
       "23    5339675 2015-05-12 23:13:00  浙江省      苍南县    10   1    5\n",
       "24    5339681 2015-05-06 15:51:00  江苏省      江阴市    10   1    5\n",
       "25    5339069 2015-05-05 21:14:00  山东省      枣庄市     1   2  198\n",
       "26    5339070 2015-05-27 23:23:00  广东省      深圳市     9   1  145\n",
       "27    5339071 2015-05-17 17:52:00  四川省      巫溪县     1   3  297\n",
       "28    5339072 2015-05-16 12:29:00  江苏省      常州市     1   1  100\n",
       "29    5339073 2015-05-04 13:49:00  河北省       景县     1   2  198\n",
       "...       ...                 ...  ...      ...   ...  ..  ...\n",
       "9970  5348653 2015-05-12 11:46:00  浙江省      舟山市     1   1   99\n",
       "9971  5349015 2015-05-05 17:01:00  江苏省       沛县     1   3  297\n",
       "9972  5348669 2015-05-14 06:38:00   广西      蒙山县     1   1   99\n",
       "9973  5349017 2015-05-03 06:33:00  广东省      潮阳市     7   3  363\n",
       "9974  5348771 2015-05-29 11:17:00  浙江省      文成县     1   1   99\n",
       "9975  5349019 2015-05-04 04:54:00  湖南省      新邵县     1   4  396\n",
       "9976  5349020 2015-05-26 13:51:00  广东省      珠海市     5   1  100\n",
       "9977  5349021 2015-05-28 01:32:00  江苏省      徐州市     7   2  242\n",
       "9978  5348781 2015-05-16 09:21:00  浙江省      宁波市     1   1   99\n",
       "9979  5348801 2015-05-05 08:48:00  山东省      嘉祥县     1   1   99\n",
       "9980  5348816 2015-05-18 13:27:00  海南省      屯昌县     1   1   99\n",
       "9981  5349025 2015-05-03 20:15:00  浙江省      龙游县     9   1  145\n",
       "9982  5348827 2015-05-14 14:51:00  广东省      河源市     1   1   99\n",
       "9983  5349027 2015-06-01 04:04:00  山东省      齐河县     7   3  363\n",
       "9984  5349028 2015-05-08 01:44:00  广东省      惠东县     7   2  242\n",
       "9985  5349029 2015-05-15 10:05:00  四川省      成都市     3   3  267\n",
       "9986  5348863 2015-05-09 18:12:00  江苏省      溧阳市     1   1   99\n",
       "9987  5349031 2015-05-05 18:49:00  江苏省      南京市     9   2  290\n",
       "9988  5349032 2015-05-23 07:20:00  上海市      普陀区     3   2  178\n",
       "9989  5348866 2015-05-03 19:07:00  上海市      虹口区     1   1   99\n",
       "9990  5349034 2015-05-18 09:03:00  黑龙江      桦川县     7   2  242\n",
       "9991  5348888 2015-05-23 10:02:00  上海市      松江县     1   1   99\n",
       "9992  5348910 2015-05-27 21:54:00  江苏省      泰州市     1   1   99\n",
       "9993  5348914 2015-05-25 18:16:00  山西省      宁武县     1   1   99\n",
       "9994  5348924 2015-05-01 10:10:00  广东省      新会市     1   1   99\n",
       "9995  5348938 2015-05-14 13:48:00  山西省      闻喜县     1   1   99\n",
       "9996  5348996 2015-05-06 17:34:00  上海市      徐汇区     1   1   99\n",
       "9997  5349003 2015-05-03 14:04:00  浙江省      苍南县     1   1   99\n",
       "9998  5349042 2015-05-03 09:54:00  云南省      凤庆县    -1   3  297\n",
       "9999  5349004 2015-05-26 14:04:00  山东省      日照市     1   1   99\n",
       "\n",
       "[10000 rows x 7 columns]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "data = pd.read_excel(r'F:/python数据分析/chenyun/pandas库/dataset/商品订单明细表.xlsx',)\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1、统计各省份商品销售的总收入。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "省份\n",
       "上海市    288724\n",
       "云南省     50969\n",
       "内蒙古     29000\n",
       "北京市      4729\n",
       "台湾省       150\n",
       "吉林省     22652\n",
       "四川省    113875\n",
       "天津市      7767\n",
       "宁夏      10111\n",
       "安徽省     41784\n",
       "山东省    603637\n",
       "山西省     58547\n",
       "广东省    534677\n",
       "广西      40565\n",
       "新疆      36714\n",
       "江苏省    623773\n",
       "江西省     36992\n",
       "河北省     84603\n",
       "河南省     62961\n",
       "浙江省    423412\n",
       "海南省      8557\n",
       "湖北省     45628\n",
       "湖南省     69634\n",
       "甘肃省     44375\n",
       "福建省     34435\n",
       "西藏      36117\n",
       "贵州省     29940\n",
       "辽宁省     33852\n",
       "陕西省     44202\n",
       "青海省     17537\n",
       "香港        144\n",
       "黑龙江     70700\n",
       "Name: 总收入, dtype: int64"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['总收入'] = data['计数']*data['总价格']\n",
    "data.groupby(by='省份')['总收入'].sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0        True\n",
       "1        True\n",
       "2        True\n",
       "3        True\n",
       "4        True\n",
       "5        True\n",
       "6        True\n",
       "7        True\n",
       "8        True\n",
       "9        True\n",
       "10       True\n",
       "11       True\n",
       "12       True\n",
       "13       True\n",
       "14       True\n",
       "15       True\n",
       "16       True\n",
       "17       True\n",
       "18       True\n",
       "19       True\n",
       "20       True\n",
       "21       True\n",
       "22       True\n",
       "23       True\n",
       "24       True\n",
       "25       True\n",
       "26       True\n",
       "27       True\n",
       "28       True\n",
       "29       True\n",
       "        ...  \n",
       "9970     True\n",
       "9971     True\n",
       "9972     True\n",
       "9973     True\n",
       "9974     True\n",
       "9975     True\n",
       "9976     True\n",
       "9977     True\n",
       "9978     True\n",
       "9979     True\n",
       "9980     True\n",
       "9981     True\n",
       "9982     True\n",
       "9983    False\n",
       "9984     True\n",
       "9985     True\n",
       "9986     True\n",
       "9987     True\n",
       "9988     True\n",
       "9989     True\n",
       "9990     True\n",
       "9991     True\n",
       "9992     True\n",
       "9993     True\n",
       "9994     True\n",
       "9995     True\n",
       "9996     True\n",
       "9997     True\n",
       "9998     True\n",
       "9999     True\n",
       "Name: 销售日期, Length: 10000, dtype: bool"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_s"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2、统计5月份每一天的商品销售的总收入（提示：用序列对象的agg方法）。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "每一天\n",
       "1.0     24410\n",
       "2.0     42153\n",
       "3.0     41922\n",
       "4.0     38676\n",
       "5.0     42477\n",
       "6.0     39752\n",
       "7.0     47635\n",
       "8.0     37912\n",
       "9.0     39408\n",
       "10.0    38581\n",
       "11.0    41179\n",
       "12.0    37787\n",
       "13.0    44205\n",
       "14.0    37911\n",
       "15.0    39419\n",
       "16.0    36725\n",
       "17.0    39655\n",
       "18.0    36935\n",
       "19.0    39670\n",
       "20.0    42384\n",
       "21.0    41334\n",
       "22.0    37346\n",
       "23.0    41655\n",
       "24.0    46002\n",
       "25.0    47128\n",
       "26.0    40495\n",
       "27.0    35321\n",
       "28.0    43006\n",
       "29.0    41702\n",
       "30.0    45544\n",
       "31.0    41370\n",
       "Name: 总价格, dtype: int64"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_s = data['销售日期']<pd.Timestamp('2015-6-1')\n",
    "data['每一天'] = data.loc[data_s,'销售日期']\n",
    "data_v = data.groupby(by=data['每一天'].agg(lambda x:x.day))['总价格'].sum()\n",
    "data_v\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3、统计5月1日-5月10日、5月11日-5月20日、5月21日-5月31日各个时间段的商品销售的总收入。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5月1日到10日： 392926\n",
      "5月11日到20日： 395870\n",
      "5月21到31日： 460903\n"
     ]
    }
   ],
   "source": [
    "print('5月1日到10日：',data_v[0:10].sum())\n",
    "print('5月11日到20日：',data_v[11:20].sum())\n",
    "print('5月21到31日：',data_v[21:31].sum())\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
